package com.fangcun.service.api.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.fangcun.bean.api.agent.capital.request.AgentCapitalRequest;
import com.fangcun.bean.sys.PageBean;
import com.fangcun.common.canstant.ErrCode;
import com.fangcun.common.exception.ProException;
import com.fangcun.common.exception.ProValiDataException;
import com.fangcun.entity.UserTransactionFlow;
import com.fangcun.mapper.UserTransactionFlowMapper;
import com.fangcun.service.api.UserTransactionFlowService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@Service
public class UserTransactionFlowServiceImpl implements UserTransactionFlowService{
	
	@Autowired
	private UserTransactionFlowMapper userTransactionFlowMapper;
	
	@Override  
	public PageInfo<UserTransactionFlow> list(PageBean<AgentCapitalRequest> request)throws ProException {
		PageHelper.startPage(request.getPageNum(), request.getPageSize());
		List<UserTransactionFlow> list = userTransactionFlowMapper.listForApi(request.getParam());
		if(list == null || list.size()==0) {
			throw new ProValiDataException(ErrCode.NO_DATA.getReturnCode(), ErrCode.NO_DATA.getReturnMsg());
		}
		return new PageInfo<>(list);
	}

}
